// @ts-ignore
import { api } from '@/utils/api';

/** 新增后端接口权限数据 POST /permission/api/add */
export async function permissionApiAdd(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultApiPermission>;

export async function permissionApiAdd(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultApiPermission>>;

export async function permissionApiAdd(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultApiPermission>;

export async function permissionApiAdd(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultApiPermission>(`/app/permission/api/add`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultApiPermission>(`/app/permission/api/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 新增前后端权限绑定信息 POST /permission/api/add/pageApi */
export async function permissionApiAddPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiAddPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiAddPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiAddPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/add/pageApi`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/add/pageApi`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 新增后端接口权限数据(2.1.8) POST /permission/api/cascadeAdd */
export async function permissionApiCascadeAdd(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultApiPermission>;

export async function permissionApiCascadeAdd(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultApiPermission>>;

export async function permissionApiCascadeAdd(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultApiPermission>;

export async function permissionApiCascadeAdd(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultApiPermission>(`/app/permission/api/cascadeAdd`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultApiPermission>(`/app/permission/api/cascadeAdd`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 更新后端接口权限数据(2.1.8) POST /permission/api/cascadeUpdate */
export async function permissionApiCascadeUpdate(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultApiPermission>;

export async function permissionApiCascadeUpdate(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultApiPermission>>;

export async function permissionApiCascadeUpdate(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultApiPermission>;

export async function permissionApiCascadeUpdate(
  body: BASE.CascadeUpdatePermissionDto,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultApiPermission>(`/app/permission/api/cascadeUpdate`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultApiPermission>(`/app/permission/api/cascadeUpdate`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 清空后端接口权限数据 POST /permission/api/clear */
export async function permissionApiClear(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiClear(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiClear(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiClear(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/clear`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/clear`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 删除前后端权限绑定信息 POST /permission/api/del/pageApi */
export async function permissionApiDelPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiDelPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiDelPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiDelPageApi(
  body: BASE.PagePermissionApi,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/del/pageApi`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/del/pageApi`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 删除后端接口权限数据 POST /permission/api/delete */
export async function permissionApiDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiDelete(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/delete`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/delete`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取后端接口权限数据 POST /permission/api/get */
export async function permissionApiGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultApiPermission>;

export async function permissionApiGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultApiPermission>>;

export async function permissionApiGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultApiPermission>;

export async function permissionApiGet(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultApiPermission>(`/app/permission/api/get`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultApiPermission>(`/app/permission/api/get`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取开放接口数据 POST /permission/api/getOpenApi */
export async function permissionApiGetOpenApi(
  body: BASE.AutoDtoWithPermissionApiGetopenapi,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListApiPermission>;

export async function permissionApiGetOpenApi(
  body: BASE.AutoDtoWithPermissionApiGetopenapi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListApiPermission>>;

export async function permissionApiGetOpenApi(
  body: BASE.AutoDtoWithPermissionApiGetopenapi,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListApiPermission>;

export async function permissionApiGetOpenApi(
  body: BASE.AutoDtoWithPermissionApiGetopenapi,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListApiPermission>(`/app/permission/api/getOpenApi`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListApiPermission>(`/app/permission/api/getOpenApi`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取所有表数据 POST /permission/api/getTableName */
export async function permissionApiGetTableName(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListString>;

export async function permissionApiGetTableName(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListString>>;

export async function permissionApiGetTableName(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListString>;

export async function permissionApiGetTableName(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListString>(`/app/permission/api/getTableName`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListString>(`/app/permission/api/getTableName`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取后端接口权限分页数据 POST /permission/api/page */
export async function permissionApiPage(
  body: BASE.ApiPermissionQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultIPageApiPermission>;

export async function permissionApiPage(
  body: BASE.ApiPermissionQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultIPageApiPermission>>;

export async function permissionApiPage(
  body: BASE.ApiPermissionQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultIPageApiPermission>;

export async function permissionApiPage(
  body: BASE.ApiPermissionQuery,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultIPageApiPermission>(`/app/permission/api/page`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultIPageApiPermission>(`/app/permission/api/page`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 重新加载后端接口权限数据到缓存中 POST /permission/api/reload */
export async function permissionApiReload(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function permissionApiReload(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function permissionApiReload(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function permissionApiReload(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/permission/api/reload`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/permission/api/reload`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 从服务中同步后端接口权限数据 POST /permission/api/sync */
export async function permissionApiSync(
  body: BASE.SyncPermissionDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiSync(
  body: BASE.SyncPermissionDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiSync(
  body: BASE.SyncPermissionDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiSync(
  body: BASE.SyncPermissionDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/sync`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/sync`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 前后端权限绑定 POST /permission/api/syncPageAndApi */
export async function permissionApiSyncPageAndApi(
  body: BASE.SyncPageAndApiDTO[],
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function permissionApiSyncPageAndApi(
  body: BASE.SyncPageAndApiDTO[],
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function permissionApiSyncPageAndApi(
  body: BASE.SyncPageAndApiDTO[],
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function permissionApiSyncPageAndApi(
  body: BASE.SyncPageAndApiDTO[],
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/permission/api/syncPageAndApi`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/permission/api/syncPageAndApi`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取后端接口权限树形结构数据 POST /permission/api/tree */
export async function permissionApiTree(
  body: BASE.AutoDtoWithPermissionApiTree,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListApiPermission>;

export async function permissionApiTree(
  body: BASE.AutoDtoWithPermissionApiTree,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListApiPermission>>;

export async function permissionApiTree(
  body: BASE.AutoDtoWithPermissionApiTree,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListApiPermission>;

export async function permissionApiTree(
  body: BASE.AutoDtoWithPermissionApiTree,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListApiPermission>(`/app/permission/api/tree`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListApiPermission>(`/app/permission/api/tree`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取后端接口权限树形分页结构数据 POST /permission/api/treePage */
export async function permissionApiTreePage(
  body: BASE.AutoDtoWithPermissionApiTreepage,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultIPageApiPermission>;

export async function permissionApiTreePage(
  body: BASE.AutoDtoWithPermissionApiTreepage,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultIPageApiPermission>>;

export async function permissionApiTreePage(
  body: BASE.AutoDtoWithPermissionApiTreepage,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultIPageApiPermission>;

export async function permissionApiTreePage(
  body: BASE.AutoDtoWithPermissionApiTreepage,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultIPageApiPermission>(`/app/permission/api/treePage`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultIPageApiPermission>(`/app/permission/api/treePage`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 更新后端接口权限数据 POST /permission/api/update */
export async function permissionApiUpdate(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultApiPermission>;

export async function permissionApiUpdate(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultApiPermission>>;

export async function permissionApiUpdate(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultApiPermission>;

export async function permissionApiUpdate(
  body: BASE.ApiPermission,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultApiPermission>(`/app/permission/api/update`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultApiPermission>(`/app/permission/api/update`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
